//
//  XQBaseActionSheetControl.swift
//  Spark Peso
//
//  Created by 小琦 on 2025/2/6.
//

import UIKit

class XQBaseActionSheetControl: UIControl {

    override init(frame: CGRect) {
        super.init(frame: frame)
        self.backgroundColor = UIColor.init(white: 0, alpha: 0.2)
        
        addTarget(self, action: #selector(clickBg), for: .touchUpInside)
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func transAni(type: CATransitionType, subType: CATransitionSubtype?, function: CAMediaTimingFunctionName) -> CATransition {
        let animation = CATransition()
        animation.timingFunction = CAMediaTimingFunction(name: function)
        animation.duration = 0.3
        animation.type = type
        animation.subtype = subType
        return animation
    }
    

    func opacityReduceAnimation(time: TimeInterval) -> CABasicAnimation {
        let animation = CABasicAnimation(keyPath: "opacity")
        animation.fromValue = 1
        animation.toValue = 0
        animation.duration = time
        animation.autoreverses = false
        animation.isRemovedOnCompletion = false
        animation.fillMode = .forwards
        animation.timingFunction = CAMediaTimingFunction(name: .easeIn)
        return animation
    }
        
        
    @objc func clickBg() {
        
    }
        
}
